package item.inkcloud.userservice.service;


import item.inkcloud.userservice.entity.UserInfo;
import item.inkcloud.userservice.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class GetUserInfoService {

    @Autowired
    UserMapper userMapper;


    public HashMap getInfo(String userid){
        HashMap<String,Object> resultMap = new HashMap<String, Object>();
        HashMap<String,Object> infotMap = new HashMap<String, Object>();
        resultMap.put("status",0);
            try {


            UserInfo info = userMapper.findInfoById(userid);


            infotMap.put("username",info.getUsername());
            infotMap.put("gender",info.getGender());
            infotMap.put("age",info.getAge());
            infotMap.put("introduction",info.getIntroduction());
            infotMap.put("email",info.getEmail());

            resultMap.replace("status",0,1);

            resultMap.put("data",infotMap);

            return resultMap;
            }catch (Exception e){

                return resultMap;
            }

        }





    }


